// 成功页面
class SuccessPage extends JPanel {
    public SuccessPage(PhoneRecycleApp app) {
        setLayout(new BorderLayout());
        setBackground(new Color(245, 245, 245));
        
        // 顶部导航
        JPanel header = PhoneRecycleApp.createHeader("预约成功", PhoneRecycleApp.CONFIRMATION_PAGE, app);
        add(header, BorderLayout.NORTH);
        
        // 内容面板
        JPanel contentPanel = new JPanel();
        contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
        contentPanel.setBackground(new Color(245, 245, 245));
        contentPanel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20));
        
        // 成功图标
        JLabel successIcon = new JLabel("✓", SwingConstants.CENTER);
        successIcon.setFont(new Font("Arial", Font.PLAIN, 48));
        successIcon.setForeground(new Color(76, 175, 80));
        successIcon.setAlignmentX(Component.CENTER_ALIGNMENT);
        contentPanel.add(successIcon);
        
        // 成功标题
        JLabel successLabel = new JLabel("预约成功", SwingConstants.CENTER);
        successLabel.setFont(new Font("Microsoft YaHei", Font.BOLD, 24));
        successLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
        contentPanel.add(successLabel);
        contentPanel.add(Box.createVerticalStrut(10));
        
        // 订单号
        JLabel orderLabel = new JLabel("订单号: RE20230614123456", SwingConstants.CENTER);
        orderLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 10));
        orderLabel.setForeground(new Color(102, 102, 102));
        orderLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
        contentPanel.add(orderLabel);
        contentPanel.add(Box.createVerticalStrut(20));
        
        // 配送信息卡片
        JPanel infoCard = PhoneRecycleApp.createCardPanel(null);
        
        JLabel deliveryLabel = new JLabel("顺丰快递将在04月19号（明天）08:00-09:00上门取件");
        deliveryLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 12));
        deliveryLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
        infoCard.add(deliveryLabel);
        
        // 分隔线
        JSeparator separator = new JSeparator();
        separator.setAlignmentX(Component.LEFT_ALIGNMENT);
        infoCard.add(Box.createVerticalStrut(10));
        infoCard.add(separator);
        infoCard.add(Box.createVerticalStrut(10));
        
        // 取件地址
        JLabel addressTitle = new JLabel("取件地址");
        addressTitle.setFont(new Font("Microsoft YaHei", Font.BOLD, 12));
        addressTitle.setAlignmentX(Component.LEFT_ALIGNMENT);
        infoCard.add(addressTitle);
        
        JLabel nameLabel = new JLabel("航宇朋友 191****6666");
        nameLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 11));
        nameLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
        infoCard.add(nameLabel);
        
        JLabel addressLabel = new JLabel("辽宁省沈阳市沈北新区沈阳航空航天大学南生活区");
        addressLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 11));
        addressLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
        infoCard.add(addressLabel);
        
        // 更改按钮
        JButton changeButton = new JButton("更改取件信息");
        changeButton.setFont(new Font("Microsoft YaHei", Font.PLAIN, 10));
        changeButton.setForeground(new Color(33, 150, 243));
        changeButton.setContentAreaFilled(false);
        changeButton.setBorderPainted(false);
        changeButton.setAlignmentX(Component.LEFT_ALIGNMENT);
        infoCard.add(changeButton);
        
        contentPanel.add(infoCard);
        contentPanel.add(Box.createVerticalStrut(20));
        
        // 流程说明
        JPanel processCard = PhoneRecycleApp.createCardPanel("寄送流程");
        
        String[][] steps = {
            {"1. 寄送平台", "顺丰免费上门取件"},
            {"2. 平台验机", "专业质检师全面检测"},
            {"3. 出价打钱", "确认后立即打款到账"}
        };
        
        for (String[] step : steps) {
            JPanel stepPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0));
            stepPanel.setBackground(Color.WHITE);
            stepPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
            
            JLabel stepLabel = new JLabel(step[0]);
            stepLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 11));
            stepLabel.setPreferredSize(new Dimension(100, 30));
            
            JLabel descLabel = new JLabel(step[1]);
            descLabel.setFont(new Font("Microsoft YaHei", Font.PLAIN, 10));
            descLabel.setForeground(new Color(102, 102, 102));
            
            stepPanel.add(stepLabel);
            stepPanel.add(descLabel);
            
            processCard.add(stepPanel);
        }
        
        // 注意事项
        JButton noticeButton = new JButton("回收前注意事项");
        noticeButton.setFont(new Font("Microsoft YaHei", Font.PLAIN, 10));
        noticeButton.setForeground(new Color(33, 150, 243));
        noticeButton.setContentAreaFilled(false);
        noticeButton.setBorderPainted(false);
        noticeButton.setAlignmentX(Component.LEFT_ALIGNMENT);
        processCard.add(noticeButton);
        
        contentPanel.add(processCard);
        
        // 按钮区域
        JPanel buttonPanel = new JPanel();
        buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
        buttonPanel.setBackground(new Color(245, 245, 245));
        buttonPanel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
        
        JButton cancelButton = new JButton("取消订单");
        cancelButton.setFont(new Font("Microsoft YaHei", Font.PLAIN, 12));
        cancelButton.setBackground(new Color(245, 245, 245));
        cancelButton.setForeground(new Color(244, 67, 54));
        cancelButton.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
        cancelButton.addActionListener(e -> app.showPage(PhoneRecycleApp.HOME_PAGE));
        
        JButton viewButton = new JButton("查看订单");
        viewButton.setFont(new Font("Microsoft YaHei", Font.PLAIN, 12));
        viewButton.setBackground(new Color(255, 69, 0));
        viewButton.setForeground(Color.WHITE);
        
        buttonPanel.add(cancelButton);
        buttonPanel.add(Box.createHorizontalStrut(10));
        buttonPanel.add(viewButton);
        
        JScrollPane scrollPane = new JScrollPane(contentPanel);
        scrollPane.setBorder(BorderFactory.createEmptyBorder());
        add(scrollPane, BorderLayout.CENTER);
        add(buttonPanel, BorderLayout.SOUTH);
    }
}
